{extend name="user:base" /}
{block name="title"}<title>我的动态</title>{/block}
{block name="main"}

<!-- begin::main content -->
<main class="main-content">
    <div class="page-header d-md-flex justify-content-between align-items-center">
        <h4>{$title}</h4>
    </div>

    {foreach $list as $k=> $v}
    <div class="card p-3">
        <blockquote class="blockquote mb-0 card-body">
            <p>{:htmlspecialchars_decode($v.info)}</p>
            <footer class="blockquote-footer">
                <small class="text-muted">
                    动态发布于 <cite title="Source Title">{$v.create_time}</cite>
                </small>
            </footer>
            <button type="button" class="btn btn-outline-danger btn-floating" title="删除" onclick="del({$v.id})">
                <i class="ti-trash"></i>
            </button>
        </blockquote>
    </div>
    {/foreach}
    {$list|raw}
</main>

<script>

    function del(id) {
        var url="{:url('news/delete')}";
        layer.confirm('确定要删除此记录么？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post(url,{id:id},function (e) {
                if(e.code == 200){
                    success(e.msg);
                    setTimeout("location.reload()",1000)
                }else {
                    error(e.msg)
                }
            })
        }, function(){
            layer.msg('已取消');
        });

    }


</script>

<script type="text/html" id="titleTpl">
    <a href="javascript:;" onclick="del({{d.id}})" class="layui-btn layui-btn-xs  layui-btn-danger">删除</a>
</script>
    {/block}